#include "common.h"

#define cache_L1_b 6
#define cache_L1_e 3
#define cache_L1_s 7
#define cache_L1_B (1 << cache_L1_b)
#define cache_L1_E (1 << cache_L1_e)
#define cache_L1_S (1 << cache_L1_s)
#define cache_L2_b 6
#define cache_L2_e 4
#define cache_L2_s 12
#define cache_L2_B (1 << cache_L2_b)
#define cache_L2_E (1 << cache_L2_e)
#define cache_L2_S (1 << cache_L2_s)

typedef struct{
    uint8_t data[cache_L1_B];
    uint32_t tag;  
    bool valid;
} L1;
L1 cache_L1[cache_L1_S][cache_L1_E];//二维数组更容易理解感觉

typedef struct{
    uint8_t data[cache_L2_B];
    uint32_t tag;  
    bool valid;
    bool dirty;
} L2;
L2 cache_L2[cache_L2_S][cache_L2_E];

void init_cache();
int read_cache_L1(hwaddr_t);
void write_cache_L1(hwaddr_t, size_t, uint32_t);